package com.example.product.controller;

import com.example.product.Bean.Product;
import com.example.product.service.ProductService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;

@RestController
//@RequestMapping("/api/product")
public class ProductController {

    @Autowired
    ProductService productService;

    // 查询商品
    @GetMapping("/product/{Id}")
    public Product getProduct(@PathVariable("Id") Long productId) {
        System.out.println("查询商品");
        return productService.getProductById(productId);
    }
}
